home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-12 | 14.2 KB | 386 lines | [TEXT/CCL2] |
-
- (in-package :TRAPS) ;
- ; File: Drag.p
- ;
- ; Contains: External Interface to Drag Manager
- ;
- ; Copyright: © 1992-1993 by Apple Computer, Inc., all rights reserved.
- ;
-
- ; $IFC UNDEFINED UsingIncludes
- ; $SETC UsingIncludes := 0
- ; $ENDC
-
- ; $IFC NOT UsingIncludes
-
- ; $ENDC
-
- ; $IFC UNDEFINED UsingDrag
- ; $SETC UsingDrag := 1
-
- ; $I+
- ; $SETC DragIncludes := UsingIncludes
- ; $SETC UsingIncludes := 1
- ; $IFC UNDEFINED UsingAppleEvents
-
- (require-interface 'APPLEEVENTS); $I $$Shell(PInterfaces)AppleEvents.p
- ; $ENDC
- ; $IFC UNDEFINED UsingTextEdit
-
- (require-interface 'TEXTEDIT) ; $I $$Shell(PInterfaces)TextEdit.p
- ; $ENDC
- ; $SETC UsingIncludes := DragIncludes
-
- ; Gestalt Selector and Response Constants (will move to GestaltEqu.p)
-
- (defconstant $gestaltDragMgrAttr :|drag|); Drag Manager attributes
- (defconstant $gestaltDragMgrPresent 0); Drag Manager is present
-
- (defconstant $gestaltTEAttr :|teat|); TextEdit attributes
- (defconstant $gestaltTEHasGetHiliteRgn 0); TextEdit has TEGetHiliteRgn
-
- ; Flavor Flags
-
- (defconstant $flavorSenderOnly #X1); flavor is available to sender only
- (defconstant $flavorSenderTranslated #X2); flavor is translated by sender
- (defconstant $flavorNotSaved #X4); flavor should not be saved
- (defconstant $flavorSystemTranslated #X100); flavor is translated by system
-
- (def-mactype :FLAVORFLAGS (find-mactype :SIGNED-LONG))
-
- ; Drag Attributes
-
- (defconstant $dragHasLeftSenderWindow #X1); drag has left the source window since TrackDrag
- (defconstant $dragInsideSenderApplication #X2); drag is occurring within the source application
- (defconstant $dragInsideSenderWindow #X4); drag is occurring within the source window
-
- (def-mactype :DRAGATTRIBUTES (find-mactype :SIGNED-LONG))
-
- ; Special Flavor Types
-
- (defconstant $flavorTypeHFS :|hfs |); flavor type for HFS data
- (defconstant $flavorTypePromiseHFS :|phfs|); flavor type for promised HFS data
- (defconstant $flavorTypeDirectory :|diry|); flavor type for AOCE directory
-
- ; Drag Tracking Handler Messages
-
- (defconstant $dragTrackingEnterHandler 1); drag has entered handler
- (defconstant $dragTrackingEnterWindow 2); drag has entered window
- (defconstant $dragTrackingInWindow 3); drag is moving within window
- (defconstant $dragTrackingLeaveWindow 4); drag has exited window
- (defconstant $dragTrackingLeaveHandler 5); drag has exited handler
-
- (def-mactype :DRAGTRACKINGMESSAGE (find-mactype :SIGNED-INTEGER))
-
- ; Drag Drawing Procedure Messages
-
- (defconstant $dragRegionBegin 1); initialize drawing
- (defconstant $dragRegionDraw 2) ; draw drag feedback
- (defconstant $dragRegionHide 3) ; hide drag feedback
- (defconstant $dragRegionIdle 4) ; drag feedback idle time
- (defconstant $dragRegionEnd 5) ; end of drawing
-
- (def-mactype :DRAGREGIONMESSAGE (find-mactype :SIGNED-INTEGER))
-
- ; Zoom Acceleration
-
- (defconstant $zoomNoAcceleration 0); use linear interpolation
- (defconstant $zoomAccelerate 1) ; ramp up step size
- (defconstant $zoomDecelerate 2) ; ramp down step size
-
- (def-mactype :ZOOMACCELERATION (find-mactype :SIGNED-INTEGER))
-
- ; Drag Manager Data Types
-
- (def-mactype :DRAGREFERENCE (find-mactype :SIGNED-LONG))
- (def-mactype :ITEMREFERENCE (find-mactype :SIGNED-LONG))
-
- (def-mactype :FLAVORTYPE (find-mactype :OSTYPE))
-
- ; Result Codes - (will move to Errors.p)
-
- (defconstant $badDragRefErr -1850); unknown drag reference
- (defconstant $badDragItemErr -1851); unknown drag item reference
- (defconstant $badDragFlavorErr -1852); unknown flavor type
- (defconstant $duplicateFlavorErr -1853); flavor type already exists
- (defconstant $cantGetFlavorErr -1854); error while trying to get flavor data
- (defconstant $duplicateHandlerErr -1855); handler already exists
- (defconstant $handlerNotFoundErr -1856); handler not found
- (defconstant $dragNotAcceptedErr -1857); drag was not accepted by receiver
-
- ; HFS Flavor
-
- (defrecord HFSFlavor
- (fileType :OSTYPE) ; file type
- (fileCreator :OSTYPE) ; file creator
- (fdFlags :SIGNED-INTEGER) ; Finder flags
- (fileSpec :FSSPEC) ; file system specification
- )
-
- ; Promise HFS Flavor
-
- (defrecord PromiseHFSFlavor
- (fileType :OSTYPE) ; file type
- (fileCreator :OSTYPE) ; file creator
- (fdFlags :SIGNED-INTEGER) ; Finder flags
- (promisedFlavor :OSTYPE) ; promised flavor containing FSSpec
- )
-
- ; Application-Defined Drag Handler Routines
-
- (def-mactype :DRAGTRACKINGHANDLER (find-mactype :POINTER)); FUNCTION TrackingHandler (message : DragTrackingMessage,
- ; theWindow : WindowPtr,
- ; handlerRefCon : Ptr,
- ; theDragRef : DragReference) : OSErr;
- (def-mactype :DRAGRECEIVEHANDLER (find-mactype :POINTER)); FUNCTION ReceiveHandler (theWindow : WindowPtr,
- ; handlerRefCon : Ptr,
- ; theDragRef : DragReference) : OSErr;
-
- ; Application-Defined Routines
-
- (def-mactype :DRAGSENDDATAPROC (find-mactype :POINTER)); FUNCTION SendDataProc (theType : FlavorType,
- ; dragSendRefCon : Ptr,
- ; theItemRef : ItemReference,
- ; theDragRef : DragReference) : OSErr;
- (def-mactype :DRAGINPUTPROC (find-mactype :POINTER)); FUNCTION InputProc (VAR mouse : Point,
- ; VAR modifiers : INTEGER,
- ; dragInputRefCon : Ptr,
- ; theDragRef : DragReference) : OSErr;
- (def-mactype :DRAGDRAWINGPROC (find-mactype :POINTER)); FUNCTION DrawingProc (message : DragRegionMessage,
- ; showRegion : RgnHandle,
- ; showOrigin : Point,
- ; hideRegion : RgnHandle,
- ; hideOrigin : Point,
- ; dragDrawingRefCon : Ptr,
- ; theDragRef : DragReference) : OSErr;
-
- ; Drag Manager Routines
-
- ; Installing and Removing Drag Handlers
-
-
- (deftrap _installtrackinghandler ((trackinghandler :pointer) (thewindow :windowptr) (handlerrefcon :pointer))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 1 trackinghandler thewindow handlerrefcon))
-
-
- (deftrap _installreceivehandler ((receivehandler :pointer) (thewindow :windowptr) (handlerrefcon :pointer))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 2 receivehandler thewindow handlerrefcon))
-
-
- (deftrap _removetrackinghandler ((trackinghandler :pointer) (thewindow :windowptr))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 3 trackinghandler thewindow))
-
-
- (deftrap _removereceivehandler ((receivehandler :pointer) (thewindow :windowptr))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 4 receivehandler thewindow))
-
- ; Creating and Disposing Drag References
-
-
- (deftrap _newdrag ((thedragref (:pointer :signed-long)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 5 thedragref))
-
-
- (deftrap _disposedrag ((thedragref :signed-long))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 6 thedragref))
-
- ; Adding Drag Item Flavors
-
-
- (deftrap _adddragitemflavor ((thedragref :signed-long) (theitemref :signed-long) (thetype :ostype) (dataptr :pointer) (datasize :size) (theflags :signed-long))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 7 thedragref theitemref thetype dataptr datasize theflags))
-
-
- (deftrap _addhfsflavor ((thedragref :signed-long) (theitemref :signed-long) (filespec :fsspec) (theflags :signed-long))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 8 thedragref theitemref filespec theflags))
-
-
- (deftrap _setdragitemflavordata ((thedragref :signed-long) (theitemref :signed-long) (thetype :ostype) (dataptr :pointer) (datasize :size) (dataoffset :signed-long))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 9 thedragref theitemref thetype dataptr datasize dataoffset))
-
- ; Providing Drag Callback Procedures
-
-
- (deftrap _setdragsendproc ((thedragref :signed-long) (sendproc :pointer) (dragsendrefcon :pointer))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 10 thedragref sendproc dragsendrefcon))
-
-
- (deftrap _setdraginputproc ((thedragref :signed-long) (inputproc :pointer) (draginputrefcon :pointer))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 11 thedragref inputproc draginputrefcon))
-
-
- (deftrap _setdragdrawingproc ((thedragref :signed-long) (drawingproc :pointer) (dragdrawingrefcon :pointer))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 12 thedragref drawingproc dragdrawingrefcon))
-
- ; Performing a Drag
-
-
- (deftrap _trackdrag ((thedragref :signed-long) (theevent :eventrecord) (theregion :rgnhandle))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 13 thedragref theevent theregion))
-
- ; Getting Drag Item Information
-
-
- (deftrap _countdragitems ((thedragref :signed-long) (numitems (:pointer :signed-integer)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 14 thedragref numitems))
-
-
- (deftrap _getdragitemreferencenumber ((thedragref :signed-long) (index :signed-integer) (theitemref (:pointer :signed-long)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 15 thedragref index theitemref))
-
-
- (deftrap _countdragitemflavors ((thedragref :signed-long) (theitemref :signed-long) (numflavors (:pointer :signed-integer)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 16 thedragref theitemref numflavors))
-
-
- (deftrap _getflavortype ((thedragref :signed-long) (theitemref :signed-long) (index :signed-integer) (thetype (:pointer :ostype)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 17 thedragref theitemref index thetype))
-
-
- (deftrap _getflavorflags ((thedragref :signed-long) (theitemref :signed-long) (thetype :ostype) (theflags (:pointer :signed-long)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 18 thedragref theitemref thetype theflags))
-
-
- (deftrap _getflavordatasize ((thedragref :signed-long) (theitemref :signed-long) (thetype :ostype) (datasize (:pointer :size)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 19 thedragref theitemref thetype datasize))
-
-
- (deftrap _getflavordata ((thedragref :signed-long) (theitemref :signed-long) (thetype :ostype) (dataptr :pointer) (datasize (:pointer :size)) (dataoffset :signed-long))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 20 thedragref theitemref thetype dataptr datasize dataoffset))
-
-
- (deftrap _getdragitembounds ((thedragref :signed-long) (theitemref :signed-long) (itembounds (:pointer :rect)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 21 thedragref theitemref itembounds))
-
-
- (deftrap _setdragitembounds ((thedragref :signed-long) (theitemref :signed-long) (itembounds :rect))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 22 thedragref theitemref itembounds))
-
-
- (deftrap _getdroplocation ((thedragref :signed-long) (droplocation (:pointer :aedesc)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 23 thedragref droplocation))
-
-
- (deftrap _setdroplocation ((thedragref :signed-long) (droplocation :aedesc))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 24 thedragref droplocation))
-
- ; Getting Information About a Drag
-
-
- (deftrap _getdragattributes ((thedragref :signed-long) (flags (:pointer :signed-long)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 25 thedragref flags))
-
-
- (deftrap _getdragmouse ((thedragref :signed-long) (mouse (:pointer :point)) (pinnedmouse (:pointer :point)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 26 thedragref mouse pinnedmouse))
-
-
- (deftrap _setdragmouse ((thedragref :signed-long) (pinnedmouse :point))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 27 thedragref pinnedmouse))
-
-
- (deftrap _getdragorigin ((thedragref :signed-long) (initialmouse (:pointer :point)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 28 thedragref initialmouse))
-
-
- (deftrap _getdragmodifiers ((thedragref :signed-long) (modifiers (:pointer :signed-integer)) (mousedownmodifiers (:pointer :signed-integer)) (mouseupmodifiers (:pointer :signed-integer)))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 29 thedragref modifiers mousedownmodifiers mouseupmodifiers))
-
- ; Drag Highlighting
-
-
- (deftrap _showdraghilite ((thedragref :signed-long) (hiliteframe :rgnhandle) (inside :boolean))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 30 thedragref hiliteframe inside))
-
-
- (deftrap _hidedraghilite ((thedragref :signed-long))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 31 thedragref))
-
-
- (deftrap _dragprescroll ((thedragref :signed-long) (dh :signed-integer) (dv :signed-integer))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 32 thedragref dh dv))
-
-
- (deftrap _dragpostscroll ((thedragref :signed-long))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 33 thedragref))
-
-
- (deftrap _updatedraghilite ((thedragref :signed-long) (updatergn :rgnhandle))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 34 thedragref updatergn))
-
- ; Drag Manager Utilities
-
-
- (deftrap _waitmousemoved ((initialmouse :point))
- (:stack :boolean)
- (:stack-trap #xABED :d0 35 initialmouse))
-
-
- (deftrap _zoomrects ((fromrect :rect) (torect :rect) (zoomsteps :signed-integer) (acceleration :signed-integer))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 36 fromrect torect zoomsteps acceleration))
-
-
- (deftrap _zoomregion ((region :rgnhandle) (zoomdistance :point) (zoomsteps :signed-integer) (acceleration :signed-integer))
- (:stack :signed-integer)
- (:stack-trap #xABED :d0 37 region zoomdistance zoomsteps acceleration))
-
- ; Will move to TextEdit.p
-
- (deftrap _tegethilitergn ((region :rgnhandle) (hte :tehandle))
- (:stack :signed-integer)
- (:stack-trap #xA83D region hte (15 :signed-integer)))
-
- ; $ENDC ; UsingDrag
-
- ; $IFC NOT UsingIncludes
-
- ; $ENDC
-
- (export '($DRAGNOTACCEPTEDERR $HANDLERNOTFOUNDERR $DUPLICATEHANDLERERR
- $CANTGETFLAVORERR $DUPLICATEFLAVORERR $BADDRAGFLAVORERR
- $BADDRAGITEMERR $BADDRAGREFERR $ZOOMDECELERATE $ZOOMACCELERATE
- $ZOOMNOACCELERATION $DRAGREGIONEND $DRAGREGIONIDLE $DRAGREGIONHIDE
- $DRAGREGIONDRAW $DRAGREGIONBEGIN $DRAGTRACKINGLEAVEHANDLER
- $DRAGTRACKINGLEAVEWINDOW $DRAGTRACKINGINWINDOW
- $DRAGTRACKINGENTERWINDOW $DRAGTRACKINGENTERHANDLER
- $FLAVORTYPEDIRECTORY $FLAVORTYPEPROMISEHFS $FLAVORTYPEHFS
- $DRAGINSIDESENDERWINDOW $DRAGINSIDESENDERAPPLICATION
- $DRAGHASLEFTSENDERWINDOW $FLAVORSYSTEMTRANSLATED $FLAVORNOTSAVED
- $FLAVORSENDERTRANSLATED $FLAVORSENDERONLY $GESTALTTEHASGETHILITERGN
- $GESTALTTEATTR $GESTALTDRAGMGRPRESENT $GESTALTDRAGMGRATTR))
- (provide-interface 'Drag)